module.exports = {
  presets: [
    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: [
    '@babel/plugin-proposal-object-rest-spread', // 支持...rest
    '@babel/plugin-proposal-export-default-from', // 支持 export v from 'mod'语法
    '@babel/plugin-proposal-export-namespace-from', // 支持 export * as ns from 'mod'
    '@babel/plugin-syntax-dynamic-import', // 支持动态import
    ['component', { 'libraryName': 'element-ui', 'styleLibraryName': 'theme-chalk' }], // element-ui按需加载配置
    // ['import', { 'libraryName': 'ant-design-vue', 'libraryDirectory': 'es', 'style': 'css' }] // antd-vue按需加载配置 `style: true` 会加载 less 文件
  ],
  'env': {
    'development': {
      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
      // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
      'plugins': ['dynamic-import-node']
    }
  }
};
